window.onload = function () {
    const img = document.querySelector('.set a img')
    const lis = document.querySelectorAll('li')
    const clear = document.querySelector('.clear')
    const sucess = document.querySelector('.sucess')
    const button = document.querySelector('button')
    const affirm_1 = document.querySelector('.affirm_1')
    const affirm = document.querySelector('.affirm')
    const cache = document.querySelector('.cache')
    img.addEventListener('touchstart',function(){
        location.href = './我的主页.html'
    })
    lis[0].addEventListener('touchstart',function(){
        location.href = './换绑手机.html'
    })
    lis[1].addEventListener('touchstart',function(){
        location.href = './修改密码.html'
    })
    lis[2].addEventListener('touchstart',function(){
        location.href = './消息通知设置.html'
    })
    lis[3].addEventListener('touchstart',function(){
        location.href = './修改密码.html'
    })
    lis[4].addEventListener('touchstart',function(){
        cache.style.display = 'block'
        const cancel = document.querySelector('.cancel')
        cancel.addEventListener('touchstart',function(){
            cache.style.display = 'none'
        })
        const clear = document.querySelector('.clear')
        clear.addEventListener('touchstart',function(){
            localStorage.clear();
            cache.style.display = 'none'
            let num = 3
            const setTime = setInterval(() => {
               num--
               sucess.style.display = 'block'
               if(num === 0){
                  clearInterval(setTime)
                  sucess.style.display = 'none'
              }
             }, 1000);
        })
    })
    button.addEventListener('touchstart',function(){
        cache.style.display = 'block'
        affirm.style.display = 'none'
        affirm_1.style.display = 'block'
        const cancel1 = document.querySelector('.cancel_1')
        cancel1.addEventListener('touchstart',function(){
            cache.style.display = 'none'
        })
        const clear1 = document.querySelector('.clear_1')
        clear1.addEventListener('touchstart',function(){
            localStorage.clear();
            cache.style.display = 'none'
            location.href = './login.html'
        })
    })
}